package com.ycsj.goldmedalnewconcept.teacher.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.ycsj.common.image.ImageUtil;
import com.ycsj.goldmedalnewconcept.R;
import com.ycsj.goldmedalnewconcept.teacher.bean.BmPeopleInfo;

import java.util.List;

/**
 * 报名名单的列表适配器
 * Created by Administrator on 2019/4/2 0002.
 */

public class RvPeopleAdapter extends BaseQuickAdapter<BmPeopleInfo.ListBean, BaseViewHolder> {

    private Context context;

    public RvPeopleAdapter(Context context, int layoutResId, @Nullable List<BmPeopleInfo.ListBean> data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, BmPeopleInfo.ListBean item) {
        //头像
        RoundedImageView lvHead = helper.getView(R.id.lv_head);
        ImageUtil.displayImage(context,lvHead,item.stuIcon,R.drawable.head_default);

        //姓名
        TextView tvName = helper.getView(R.id.tv_name);
        tvName.setText(item.stuName);

        //班级
        TextView tvClass = helper.getView(R.id.tv_class);
        if(TextUtils.isEmpty(item.className)){
            tvClass.setText("暂无");
        }else{
            tvClass.setText(item.className);
        }


        //电话
        TextView tvTel = helper.getView(R.id.tv_tel);
        tvTel.setText(item.stuMobile);
    }
}
